#pragma once

class Business;

class RequestTimeout
{
public:
	enum TYPE {BASE,ORDER,CANCEL,HIGH,QUERY_MBL,WAITABLE};

	RequestTimeout(Business* business,int contract, int localId,TYPE type)
		:m_business(business),m_contract(contract),m_localId(localId),m_type(type)
	{
	}

	static RequestTimeout CreateBase(Business* business)
	{
		return RequestTimeout(business,-1,-1,BASE);
	}

	static RequestTimeout CreateWaitable(Business* business)
	{
		return RequestTimeout(business,-1,-1,WAITABLE);
	}
	static RequestTimeout CreateHigh(Business* business)
	{
		return RequestTimeout(business,-1,-1,HIGH);
	}
	static RequestTimeout CreateQueryMbl()
	{
		return RequestTimeout(NULL,-1,-1,QUERY_MBL);
	}
	Business* GetBusiness() const { return m_business; }
	int GetContract() const { return m_contract; }
	int GetLocalId() const { return m_localId; }
	TYPE GetType() const { return m_type; }

	bool operator==(RequestTimeout const& other) const
	{
		return m_business == other.m_business &&
			m_contract == other.m_contract &&
			m_localId == other.m_localId &&
			m_type == other.m_type;
	}
	bool operator!=(RequestTimeout const& other) const
	{
		return !operator==(other);
	}
private:
	Business* m_business;
	int m_contract;
	int m_localId;
	TYPE m_type;
};